package org.shock.ss.sms.service.system.impl;

import java.util.List;

import org.shock.ss.sms.commons.db.ProxoolDbPool;

import org.shock.ss.sms.bean.system.Portal;
import org.shock.ss.sms.commons.dao.BaseDao;
import org.shock.ss.sms.commons.service.impl.BaseServiceImpl;
import org.shock.ss.sms.service.system.PortalService;

public class PortalServiceImpl extends BaseServiceImpl implements PortalService {
	public PortalServiceImpl(BaseDao dao) {
		super(dao);
	}
	public void save(Long userid, List<Portal> list) throws Exception {
		try {
			tx = ProxoolDbPool.getTranManager();
			tx.beginTransaction();
			dao.del("delete from "+Portal.getTable()+" where userid=" + userid);
			for (Portal portal2 : list) {
				portal2.setUserid(userid);
				dao.add(portal2);
			}
			tx.commitAndClose();
		} catch (Exception e) {
			if (tx != null)
				tx.rollbackAndClose();
			throw e;
		}
	}

}
